package com.bjsxt;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

public class IteratorVectorTest {
    public static void main(String[] args) {
        List<String> list = new Vector<>();
        list.add("a");
        list.add("b");
        list.add("a");

        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()){
            String val = iterator.next();
            System.out.println(val);
        }
        System.out.println("------------");
        for(Iterator<String> it= list.iterator(); iterator.hasNext();){
            String val1 = iterator.next();
            System.out.println(val1);
        }
    }
}
